import request from '@/utils/request'

// 获取订单列表
export const getOrders = (params) => request.get('/api/orders', params)

// 获取订单详情
export const getOrderDetail = (id) => request.get(`/api/orders/${id}`)

// 创建订单
export const createOrder = (data) => request.post('/api/orders', data)

// 验证订单
export const validateOrder = (data) => request.post('/api/orders/validate', data)

// 取消订单
export const cancelOrder = (id, reason) => request.put(`/api/orders/${id}/cancel`, { reason })

// 根据预约码查询订单
export const getOrderByReservationCode = (code) => request.get(`/api/orders/reservation/${code}`)

// 获取订单统计
export const getOrderStatistics = (params) => request.get('/api/orders/statistics/summary', params)

// 获取订单二维码
export const getOrderQRCode = (orderId, params = {}) => request.get(`/api/orders/${orderId}/qrcode`, params)

// 验证订单二维码
export const verifyOrderQRCode = (data) => request.post('/api/orders/verify-qr', data)

// 刷新订单二维码
export const refreshOrderQRCode = (orderId) => request.post(`/api/orders/${orderId}/refresh-qr`)

// 更新订单状态（管理员）
export const updateOrderStatus = (orderId, data) => request.put(`/api/admin/orders/${orderId}/status`, data)


